package com.tq.teaching_quality.controller;


import com.tq.teaching_quality.entity.SurveyQuestion;
import com.tq.teaching_quality.entity.SurveyQuestion;
import com.tq.teaching_quality.service.SurveyQuestionService;
import com.tq.teaching_quality.service.SurveyQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 问卷 前端控制器
 * </p>
 *
 * @author YTH
 * @since 2020-06-29
 */
@RestController
@RequestMapping("/survey-question")
public class SurveyQuestionController {

    @Autowired
    private SurveyQuestionService SurveyQuestionService;

    //增加一条记录
    @RequestMapping("/AddSurveyQuestion")
    public boolean AddSurveyQuestion(@PathVariable("SurveyQuestion") SurveyQuestion SurveyQuestion){
        return SurveyQuestionService.save(SurveyQuestion);
    }

    //删除一条记录
    @RequestMapping("/DeleteSurveyQuestion")
    public boolean DeleteSurveyQuestion(@PathVariable("SurveyQuestionId") Long SurveyQuestionId){
        return SurveyQuestionService.removeById(SurveyQuestionId);
    }

    //查询全部记录
    @RequestMapping("/SelectAllSurveyQuestion")
    public List<SurveyQuestion> SelectAllSurveyQuestion(){
        return SurveyQuestionService.list();
    }

    //修改一条记录
    @RequestMapping("/UpdateSurveyQuestion")
    public boolean UpdateSurveyQuestion(@PathVariable("SurveyQuestion") SurveyQuestion SurveyQuestion){
        return SurveyQuestionService.updateById(SurveyQuestion);
    }



}

